package mymobile.diagram.part;

import java.util.Collections;
import java.util.List;

import mymobile.diagram.providers.MyMobileElementTypes;

import org.eclipse.gef.Tool;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteGroup;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;

/**
 * @generated
 */
public class MyMobilePaletteFactory {

	/**
	 * @generated
	 */
	public void fillPalette(PaletteRoot paletteRoot) {
		paletteRoot.add(createMymobile1Group());
	}

	/**
	 * Creates "mymobile" palette tool group
	 * @generated
	 */
	private PaletteContainer createMymobile1Group() {
		PaletteGroup paletteContainer = new PaletteGroup(
				Messages.Mymobile1Group_title);
		paletteContainer.setId("createMymobile1Group"); //$NON-NLS-1$
		paletteContainer.add(createSetting1CreationTool());
		paletteContainer.add(createView2CreationTool());
		paletteContainer.add(createAppMobile3CreationTool());
		paletteContainer.add(createInput4CreationTool());
		paletteContainer.add(createImage5CreationTool());
		paletteContainer.add(createLabel6CreationTool());
		paletteContainer.add(createList7CreationTool());
		return paletteContainer;
	}

	/**
	 * @generated
	 */
	private ToolEntry createSetting1CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Setting1CreationTool_title,
				Messages.Setting1CreationTool_desc,
				Collections.singletonList(MyMobileElementTypes.View_2005));
		entry.setId("createSetting1CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(MyMobileElementTypes
				.getImageDescriptor(MyMobileElementTypes.View_2005));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createView2CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				Messages.View2CreationTool_title,
				Messages.View2CreationTool_desc,
				Collections.singletonList(MyMobileElementTypes.Input_2006));
		entry.setId("createView2CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(MyMobileElementTypes
				.getImageDescriptor(MyMobileElementTypes.Input_2006));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createAppMobile3CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				Messages.AppMobile3CreationTool_title,
				Messages.AppMobile3CreationTool_desc,
				Collections.singletonList(MyMobileElementTypes.List_2007));
		entry.setId("createAppMobile3CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(MyMobileElementTypes
				.getImageDescriptor(MyMobileElementTypes.List_2007));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createInput4CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Input4CreationTool_title,
				Messages.Input4CreationTool_desc,
				Collections.singletonList(MyMobileElementTypes.AppMobile_2008));
		entry.setId("createInput4CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(MyMobileElementTypes
				.getImageDescriptor(MyMobileElementTypes.AppMobile_2008));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createImage5CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Image5CreationTool_title,
				Messages.Image5CreationTool_desc,
				Collections.singletonList(MyMobileElementTypes.Label_2009));
		entry.setId("createImage5CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(MyMobileElementTypes
				.getImageDescriptor(MyMobileElementTypes.Label_2009));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createLabel6CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Label6CreationTool_title,
				Messages.Label6CreationTool_desc,
				Collections.singletonList(MyMobileElementTypes.Setting_2010));
		entry.setId("createLabel6CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(MyMobileElementTypes
				.getImageDescriptor(MyMobileElementTypes.Setting_2010));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createList7CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				Messages.List7CreationTool_title,
				Messages.List7CreationTool_desc,
				Collections.singletonList(MyMobileElementTypes.Image_2011));
		entry.setId("createList7CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(MyMobileElementTypes
				.getImageDescriptor(MyMobileElementTypes.Image_2011));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private static class NodeToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List<IElementType> elementTypes;

		/**
		 * @generated
		 */
		private NodeToolEntry(String title, String description,
				List<IElementType> elementTypes) {
			super(title, description, null, null);
			this.elementTypes = elementTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}

	/**
	 * @generated
	 */
	private static class LinkToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List<IElementType> relationshipTypes;

		/**
		 * @generated
		 */
		private LinkToolEntry(String title, String description,
				List<IElementType> relationshipTypes) {
			super(title, description, null, null);
			this.relationshipTypes = relationshipTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}
}
